Skip to content

POC: avoid duplicate Lite workspace refreshes - #15605

Draft
estib-vega wants to merge 7 commits into
masterfrom
esteban/gb-1727-spike-investigate-correlating-watcher-events-to-lite
Draft

POC: avoid duplicate Lite workspace refreshes#15605
estib-vega wants to merge 7 commits into
masterfrom
esteban/gb-1727-spike-investigate-correlating-watcher-events-to-lite

Conversation

@estib-vega

@estib-vega estib-vega commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🧢 Changes

POC for avoiding duplicate Lite workspace refreshes after mutations.

  • Computes an opaque WorkspaceRevision from the semantic inputs used to build the workspace graph.
  • Returns the revision with headInfo, mutation responses, and watcher events.
  • Updates Lite's existing TanStack Query cache with the mutation result and skips headInfo only when the watcher revision exactly matches it.
  • Uses coherence checks and a nullable revision so uncertain or stale reads always fall back to a full refresh.
  • Treats Git config, packed-refs, and shallow-boundary changes as unconditional refreshes without reloading the watcher's long-lived repository.
  • Adds unit, repository-backed watcher, Electron E2E, benchmark, and temporary diagnostic coverage.
flowchart LR
    M[Lite mutation] --> B[Build workspace + revision]
    B --> C[Cache projection + revision]
    W[Debounced watcher event] --> R[Compute revision]
    R --> E{Matches cached revision?}
    C --> E
    E -->|Yes| S[Keep cached headInfo]
    E -->|No or null| F[Fetch fresh headInfo]
Loading

☕️ Reasoning

Filesystem events cannot be reliably correlated with the mutation that caused them. Comparing the resulting semantic state avoids suppressing unrelated external changes while eliminating the common mutation-response/watcher duplicate fetch.

This is intentionally a POC. It keeps the safe existing refresh path whenever equality cannot be proven, does not reload the repository inside the watcher, and includes temporary structured diagnostics for dogfooding. A real-world benchmark with populated forge associations remains follow-up work.

@linear-code

linear-code Bot commented Aug 27, 2026

Copy link
Copy Markdown

GB-1727

@estib-vega
estib-vega force-pushed the esteban/gb-1727-spike-investigate-correlating-watcher-events-to-lite branch from 75e6b12 to 35c91a8 Compare August 27, 2026 14:49
@github-actions github-actions Bot added rust Pull requests that update Rust code @gitbutler/desktop @gitbutler/lite labels Aug 27, 2026
@estib-vega
estib-vega requested a review from mtsgrd August 28, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@gitbutler/desktop @gitbutler/lite rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant